package com.spider.test01;

public class Demo4 {
    public static void main(String[] args) {
        int[] arr = {10,20,30,40,50};
        System.out.println(getMin(arr));
    }
    //需求：获取一维数组的最小值
    public static int getMin(int[] arr){
        int min = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (min > arr[i])
            {
                min = arr[i];
            }
        }
        return min;
    }
}
